@extends('admin.master')

@section('css')
    <meta name="csrf-token" content="{{ csrf_token() }}">
    @stop

    @section('page_header')
    <h1 class="page-title">
        <i class="voyager-settings"></i>系统设置
    </h1>
    @stop

    @section('content')
    <div class="page-content container-fluid">
        <div class="row">
            <div class="col-md-12">

                <div class="panel panel-bordered">

                    <div class="panel-heading">
                        <h3 class="panel-title">系统设置</h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form role="form" class="form-horizontal"
                          action="{{ route('admin.settings.edit') }}"
                          method="POST" enctype="multipart/form-data">
                        <!-- PUT Method if we are editing -->
                        @if(isset($dataTypeContent->id))
                            {{ method_field("PUT") }}
                        @endif
                        <!-- CSRF TOKEN -->
                        {{ csrf_field() }}
                        <div class="panel-body">
                            @if (count($errors) > 0)
                                <div class="alert alert-danger">
                                    <ul>
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            @endif
                            <div class="form-group">
                                <label for="name" class="col-sm-1 control-label">标题</label>
                                <div class="col-sm-11">
                                    <input type="text" class="form-control" name="title"
                                        placeholder="请输入系统名" id="title"
                                        value="@if (isset($setting->title)){{$setting->title}}@endif">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="password" class="col-sm-1 control-label">标题logo</label>
                                <div class="col-sm-11">
                                @if (isset($setting->title_logo))
                                    <img src="/storage/{{$setting->title_logo}}"
                                         style="width:200px; height:auto; clear:both; display:block; padding:2px; border:1px solid #ddd; margin-bottom:10px;">
                                    <input type="file" name="title_logo">
                                </div>
                                @endif
                            </div>
                            <div class="form-group">
                                <label for="password" class="col-sm-1 control-label">系统logo</label>
                                <div class="col-sm-11">
                                @if (isset($setting->xt_logo))
                                    <img src="/storage/{{$setting->xt_logo}}"
                                         style="width:200px; height:auto; clear:both; display:block; padding:2px; border:1px solid #ddd; margin-bottom:10px;">
                                    <input type="file" name="xt_logo">
                                @endif
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="password" class="col-sm-1 control-label">背景图</label>
                                <div class="col-sm-11">
                                @if (isset($setting->bg))
                                    <img src="/storage/{{$setting->bg}}"
                                         style="width:200px; height:auto; clear:both; display:block; padding:2px; border:1px solid #ddd; margin-bottom:10px;">
                                    <input type="file" name="bg">
                                @endif
                                </div>
                            </div>
                        </div><!-- panel-body -->
                        <div class="panel-footer">
                            <button type="submit" onclick="return check()" class="btn btn-primary">提交</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    @stop
    @section('javascript')
    <script>
        $('document').ready(function () {
            $('.toggleswitch').bootstrapToggle();
        });
    </script>
    <script>
        function check() {
            var title = $("#title").val();
            if (title.trim() == '') {
                toastr.error("系统标题不能为空");
                return false;
            }
        }

    </script>
    <script src="/js/tinymce.min.js"></script>
    <script src="/js/voyager_tinymce.js"></script>
@stop
